import request from 'utils/request'

// 获取文章列表
export const getArticles = (params) => {
  return request({
    url:'/mp/articles',
    method:'get',
    params
  })
}
// 删除文章
export const delArticles = (id) => {
  return request({
    url:'/mp/articles/'+id,
    method:'delete'
  })
}
// 上传文章
export const addArticles = (data,draft) => {
  return request({
    url:'/mp/articles?draft='+draft,
    method:'post',
    data
  })
}
// 获取文章
export const getArticleById = (id) => {
  return request({
    url:'/mp/articles/'+id,
    method:'get'
  })
}
// 修改文章
export const updateArticles = (data,draft) => {
  return request({
    url:'/mp/articles/'+data.id+'?draft='+draft,
    method:'put',
    data
  })
}